<!DOCTYPE html>
<html ng-app="wsscat">

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<script type="text/javascript" src="angular/angular.js"></script>

	<body ng-controller="homeCtrl">
		<input ng-model="message" ng-change="rebotRequest()" />
		<p>{{text}}</p>
	</body>
	<script>
		var app = angular.module('wsscat', []);
		app.controller('homeCtrl', ['$scope', '$http', function($scope, $http) {
			$scope.rebotRequest = function() {
				$http.jsonp('http://localhost:8888/rebot', {
					params: {
						message: $scope.message,
						callback: 'JSON_CALLBACK'
					}
				}).success(function(data) {
					console.log(data);
					$scope.text = data.text;
				})
			}
		}])
	</script>
	<style>
		input{
			width: 100%;
		}
	</style>

</html>